package br.com.imob.modelo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Gilton Nascimento
 */
@Entity
@Table(name = "\"PLANO\"",  catalog = "imob", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Plano.findAll", query = "SELECT p FROM Plano p"),
    @NamedQuery(name = "Plano.findByPlanoId", query = "SELECT p FROM Plano p WHERE p.planoId = :planoId"),

    @NamedQuery(name = "Plano.findByPlano", query = "SELECT p FROM Plano p WHERE p.plano = :plano"),
    @NamedQuery(name = "Plano.findLikeByPlano", query = "SELECT p FROM Plano p WHERE p.plano Like :plano"),
    
    @NamedQuery(name = "Plano.findByPlanoDescricao", query = "SELECT p FROM Plano p WHERE p.planoDescricao = :planoDescricao"),
    @NamedQuery(name = "Plano.findLikeByPlanoDescricao", query = "SELECT p FROM Plano p WHERE p.planoDescricao Like :planoDescricao"),
    
    @NamedQuery(name = "Plano.findByPeriodo", query = "SELECT p FROM Plano p WHERE p.periodo = :periodo"),
    @NamedQuery(name = "Plano.findLikeByPeriodo", query = "SELECT p FROM Plano p WHERE p.periodo Like :periodo"),
    
    @NamedQuery(name = "Plano.findByValor", query = "SELECT p FROM Plano p WHERE p.valor = :valor"),
    @NamedQuery(name = "Plano.findByQtdAnuncio", query = "SELECT p FROM Plano p WHERE p.qtdAnuncio = :qtdAnuncio")})
public class Plano implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
//  <editor-fold defaultstate="collapsed" desc="Geradores de Sequencias">
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
    @SequenceGenerator(name = "SEQ_STORE", sequenceName = "next_plano")// </editor-fold>
    @Basic(optional = false)
    @Column(name = "plano_id", nullable = false)
    private Integer planoId;
    
    @Basic(optional = false)
    @Column(name = "plano", nullable = false, length = 20)
    private String plano;
    
    @Column(name = "plano_descricao", length = 2147483647)
    private String planoDescricao;
    
    @Column(name = "periodo", length = 20)
    private String periodo;
    
    @Basic(optional = false)
    @Column(name = "valor", nullable = false)
    private double valor;

    @Basic(optional = false)
    @Column(name = "qtd_anuncio", nullable = false)
    private int qtdAnuncio;


    public Plano() {
    }

    public Plano(Integer id) { planoId = id; }
    public Plano(String plan) { plano = plan; }
    
    public Plano(Integer id, double vlr) { planoId = id; valor = vlr; }
    
    public Plano( Integer id, int qtd ) { 
    	planoId = id;
    	qtdAnuncio = qtd;
	}
    
    public Plano(Integer id, String plan) { 
    	planoId = id; plano = plan; 
	}
    
    public Plano(Integer id, String plan, int qtd) {
        planoId = id;
        plano = plan;
        qtdAnuncio = qtd;
    }
    
    public Plano(Integer id, String plan, double vlr) {
    	planoId = id;
    	plano = plan;
    	valor = vlr;
    }
    
    public Plano(Integer id, String plan, double vlr, int qtd) {
    	planoId = id;
    	plano = plan;
    	valor = vlr;
    	qtdAnuncio = qtd;
    }

	public Integer getPlanoId() {
        return planoId;
    }

    public void setPlanoId(Integer planoId) {
        this.planoId = planoId;
    }

    public String getPlano() {
        return plano;
    }

    public void setPlano(String plano) {
        this.plano = plano;
    }

    public String getPlanoDescricao() {
        return planoDescricao;
    }

    public void setPlanoDescricao(String planoDescricao) {
        this.planoDescricao = planoDescricao;
    }

    public String getPeriodo() {
        return periodo;
    }

    public void setPeriodo(String periodo) {
        this.periodo = periodo;
    }

    public double getValor() {
        return valor;
    }

    public void setValor(double valor) {
        this.valor = valor;
    }

    public int getQtdAnuncio() {
        return qtdAnuncio;
    }

    public void setQtdAnuncio(int qtdAnuncio) {
        this.qtdAnuncio = qtdAnuncio;
    }

    public Object[] getValues() {
    	Object[] objects = {planoId, plano, valor, qtdAnuncio};
    	return objects; 
    }
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (planoId != null ? planoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Plano)) {
            return false;
        }
        Plano other = (Plano) object;
        if ((this.planoId == null && other.planoId != null) || (this.planoId != null && !this.planoId.equals(other.planoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.imob.modelo.Plano[planoId=" + planoId + "]";
    }

}
